class Animal:
    def __init__(self):
        self.name = "abc"
        self.age = 19

my_dog = Animal()
print(my_dog.name)#abc


class Dog:
    # 通过外部的值来实例化类成员
    def __init__(self,name,age):
        self.name = name
        self.age = age

# 实例化时调用的就是构造函数，接受各种形式传参
his_dog = Dog(age=19,name='kk')
print(his_dog.age)

#**************作用域冲突********
class Cat:
    name = "kitty"
    def __init__(self):
        self.name = "tom"

my_cat = Cat()
# tom
print(my_cat.name)